import { Menu, Icon , Tooltip,Layout} from 'antd';
import React,{Component} from 'react';
import Workbench from './Workbench';
import {Link} from 'react-router-dom';
import Cardd from '../main/Cardd';
import Welcome from './Welcome';
require ('antd/dist/antd.css');
const {Header, Content} = Layout;

const SubMenu = Menu.SubMenu;
const text = <span>返回主页</span>;
class StudentPage extends Component{
    constructor(props){
        super(props);
        this.state={
            action:'',
            key:'',
        }
    };

    onSelect=(item, key, selectedKeys )=>{
  
      if(item.key!='setting:1'){
        this.setState({key:item.key,setting:false});
      }else{
        this.setState({setting:true});
      }
    }
    componentDidMount(){

    }
    render(){

        var obj;
        switch(this.state.key){
          case '1':
          obj=<Welcome/>
          break;
          case '2':
          obj=<Workbench/>
          break;
          case '3':
          obj=<Cardd/>
          break;
          default : 
          obj=<Welcome/>
        }
        return(
              <Layout className="aa">
               <Header className="top">
                 <Menu
                    onClick={this.onSelect}
                    mode="horizontal"
                    theme="dark"
                    style={{width:'100%',marginLeft:'-4%'}}
                  >
                  <div className="system01">学生资料管理平台</div>
                  <Menu.Item key="1" className="system" style={{marginLeft:'15%'}}>
                  <Icon type="home" />首页
                  </Menu.Item>
                  <Menu.Item key="2" className="workbench" title="工作台">
                    <Icon type="bank"  />工作台
                  </Menu.Item>
                  <Menu.Item key="3" className="application"title="应用">
                  <Icon type="appstore" />应用
                  </Menu.Item>
                  <Menu.Item className="application" style={{marginLeft: '15%'}}>
                    <Tooltip placement="bottomRight"  title={text}>
                      <Link to="/StudentPage">
                      <Icon type="laptop"  style={{ fontSize: 16 }}/>
                      </Link>
                   </Tooltip>
                  </Menu.Item>
                  <SubMenu  title={<span className="submenu-title-wrapper"><Icon type="setting" /></span>}>
                    <Menu.Item key="setting:2">
                      <Link to="/">
                      <Icon type="loading" />用户签退
                      </Link>
                    </Menu.Item>
                  </SubMenu>
                 </Menu>
               </Header>

                 <Content style={{height:'674px'}}>
                   {
                     obj
                   }
                 </Content>
                 
             </Layout>
        )
    }
}
export default StudentPage;
